<%-- 
    Document   : teamsComparison
    Created on : 12.5.2011, 20:54:25
    Author     : peto
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>

<f:setLocale value="${pageContext.request.locale}"/>
<f:setBundle basename="labelsBundle" />

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="stylesheet" type="text/css" href="../css/main.css" media="screen" />
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
        <script type="text/javascript" src="../js/superfish.js"></script>
        <script type="text/javascript" src="../js/hoverIntent.js"></script>
        <script type="text/javascript" src="../js/scripts.js"></script>
        <title><f:message key="project_title" /></title>
    </head>
    <body>
         <div class="c">
            <header>
            	<a id="logo" href="${pageContext.request.contextPath}/"></a>              
            </header>
            <nav>
                <c:if test="${not empty xml_menu}">
                    <jsp:include page="menu.jsp">
                        <jsp:param name="section" value="statistics"/>
                    </jsp:include>
                </c:if>
            </nav>
        
        	<section>
                <h1><f:message key="statistics" /></h1>
                <jsp:include page="statisticsNavigation.jsp"/>
                <h2><f:message key="team_comparision"/></h2>
                
                <c:if test="${not empty xml_teams}">
                    <c:import url="XSLT/selectTeams.xsl" var="xslt"/>
                    
                    <f:message key="select_team" var="select_team"/>
                    
                    <div class="select">
                        <div id="s1">
                            <x:transform xml="${xml_teams}" xslt="${xslt}">
                                <x:param name="select_team" value="${select_team}"/>
                                <x:param name="team" value="${team1}"/>
                            </x:transform>
                        </div>     
                        <a href="#" id="btn"><f:message key="compare"/></a>
                        <div id="s2">
                            <x:transform xml="${xml_teams}" xslt="${xslt}">
                                <x:param name="select_team" value="${select_team}"/>
                                <x:param name="team" value="${team2}"/>
                            </x:transform>
                        </div>    
                        <div class="clearfix"></div>
                    </div>
                </c:if>
                <c:if test="${not empty team1 and not empty team2}">    
                <c:import url="XSLT/teamsComparison.xsl" var="xslt"/>
                <f:message key="team" var="team"/> 
                <f:message key="players" var="players"/>
                <f:message key="stadium" var="stadium"/>
                <f:message key="referee" var="referee"/>
                <f:message key="spectators" var="spectators"/>
                <f:message key="home" var="home"/>
                <f:message key="guests" var="guests"/>
                <f:message key="score" var="score"/>                
                <x:transform xml="${xml}" xslt="${xslt}">
                    <x:param name="url" value="${pageContext.request.contextPath}"/>
                    <x:param name="team1" value="${team1}"/>
                    <x:param name="team2" value="${team2}"/>
                    <x:param name="loc_team" value="${team}" />   
                    <x:param name="loc_players" value="${players}" />
                    <x:param name="loc_stadium" value="${stadium}" />
                    <x:param name="loc_referee" value="${referee}" />
                    <x:param name="loc_spectators" value="${spectators}" />
                    <x:param name="loc_home" value="${home}" />
                    <x:param name="loc_guests" value="${guests}" />
                    <x:param name="loc_score" value="${score}" />                    
                </x:transform>
                
                
                <table class="teams">
                    <tr>
                        <td class="l head"><f:message key="team_progress"/>: <c:out value="${team1}"/></td>
                        <td></td>
                        <td class="r head"><f:message key="team_progress"/>: <c:out value="${team2}"/></td>
                    </tr>
                    <tr>
                      <td class="l">
                         <c:import url="XSLT/teamsInLeague.xsl" var="teams"/>
                         <c:import url="XSLT/playedRounds.xsl" var="rounds"/>
                         <c:import url="XSLT/teamsComparsionChart.xsl" var="pos"/>
                        <img src="http://chart.googleapis.com/chart?chxr=0,<x:transform xml="${charts}" xslt="${teams}"/>,1|1,1,<x:transform xml="${charts}" xslt="${rounds}"/>&amp;chxs=0,676767,10,0,l,676767|1,676767,10,0,l,676767&amp;chxt=y,x&amp;chs=400x225&amp;cht=lc&amp;chco=3072F3&amp;chd=t:<x:transform xml="${charts}" xslt="${pos}">
                        <x:param name="team" value="${team1}"/></x:transform>&amp;chds=<x:transform xml="${charts}" xslt="${teams}"/>,1&amp;chg=20,20,1,8&amp;chls=2&amp;chma=5,5,5,5" alt="<c:out value="${team1}"/>"/>
                       </td>
                     <td></td>
                     <td class="r">
                        <img src="http://chart.googleapis.com/chart?chxr=0,<x:transform xml="${charts}" xslt="${teams}"/>,1|1,1,<x:transform xml="${charts}" xslt="${rounds}"/>&amp;chxs=0,676767,10,0,l,676767|1,676767,10,0,l,676767&amp;chxt=y,x&amp;chs=400x225&amp;cht=lc&amp;chco=3072F3&amp;chd=t:<x:transform xml="${charts}" xslt="${pos}">
                        <x:param name="team" value="${team2}"/></x:transform>&amp;chds=<x:transform xml="${charts}" xslt="${teams}"/>,1&amp;chg=20,20,1,8&amp;chls=2&amp;chma=5,5,5,5" alt="<c:out value="${team2}"/>" />
                     </td>
                    </tr>    
                </table>
                </c:if> 
            </section>
        </div>
        
    </body>
</html>
